<template>
    <div>
        <mt-cell v-for="item in tableData"  :title="item.name" to="/helloWorld"></mt-cell>
    </div>
</template>

<script>
import http from '@/libs/http';
export default {
    name: 'NovelList',
    data () {
        return {
            tableData:[],
            pagingParams:{
                total:0,
                size:10,
                current:1
            },
            reqParams:{
                keyword:"",
                page:1,
                size:10
            }
        }
    },
    methods:{
        init(){
            this.changePage(1);
        },
        getData () {
            this.loading  = true;
            var me = this;
            http.post('/novel/find',this.reqParams,function(result){
                console.info(result)
                me.tableData = result.list;
                me.pagingParams.total =parseInt(result.count) ;
                me.loading  = false;
            })
        },
        changePage (page) {
            this.reqParams.page = page;
            this.getData();
        },
        del(id){
            let me = this;
            http.post('/novel/del/'+id,{},function(result){
                this.changePage(1);
            })
        }

    },
    mounted () {
        this.init();
    }
}
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
    .novel-icon{
        width: 48px;
        height: 48px;
        margin: 5px 0px;
    }
</style>
